home *** CD-ROM | disk | FTP | other *** search
/ Joystick Magazine 1995 July & August / cd No4 joystick No62.iso / mac / pc / SHARE / LIGHTLIB / LANGUAGE.Z / MAINFRM.CPP < prev    next >
C/C++ Source or Header  |  1995-02-23  |  4KB  |  156 lines

  1. // mainfrm.cpp : implementation of the CMainFrame class
  2. //
  3.  
  4. #include "stdafx.h"
  5.  
  6. extern "C"
  7. {
  8. #include "LLI.H"
  9. }
  10.  
  11. #include "LLID.h"
  12.  
  13. #include "mainfrm.h"
  14.  
  15. #ifdef _DEBUG
  16. #undef THIS_FILE
  17. static char BASED_CODE THIS_FILE[] = __FILE__;
  18. #endif
  19.  
  20. /////////////////////////////////////////////////////////////////////////////
  21. // CMainFrame
  22.  
  23. IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWnd)
  24.  
  25.  
  26. BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
  27.     //{{AFX_MSG_MAP(CMainFrame)
  28.     ON_WM_CREATE()
  29.     //}}AFX_MSG_MAP
  30. END_MESSAGE_MAP()
  31.                            
  32. /////////////////////////////////////////////////////////////////////////////
  33. // arrays of IDs used to initialize control bars
  34.  
  35. static UINT BASED_CODE buttons[] =
  36. {
  37.  // same order as in the bitmap 'toolbar.bmp'
  38.     ID_FILE_NEW,
  39.     ID_FILE_OPEN,
  40.     ID_FILE_SAVE_AS,
  41.     ID_FILE_PRINT,
  42.         ID_SEPARATOR,
  43.     ID_FIT_HOR,
  44.     ID_FIT_VER,
  45.     ID_FIT_WIN,
  46.     ID_UNFIT_WIN,
  47.         ID_SEPARATOR,
  48.     ID_ROT_R90,
  49.     ID_ROT_L90,
  50.     ID_ROT_180,
  51.         ID_SEPARATOR,
  52.     ID_CROP,
  53.         ID_SEPARATOR,
  54.     ID_ZOOM_IN,
  55.     ID_ZOOM_OUT,
  56.         ID_SEPARATOR,
  57.     ID_TOGGLE_PALETTE,
  58.         ID_SEPARATOR,
  59.     ID_GEN_MOSAIC,
  60.         ID_SEPARATOR,
  61.     ID_IMAGE_INFO,
  62.         ID_SEPARATOR,
  63.     ID_APP_ABOUT,
  64. };
  65.  
  66.  
  67. static UINT BASED_CODE indicators[] =
  68. {          
  69.       ID_SEPARATOR,           // status line indicator
  70.     ID_INDICATOR_CAPS,
  71.     ID_INDICATOR_NUM,
  72.     ID_INDICATOR_SCRL,
  73. };
  74.  
  75.  
  76. LLOBJECT  lloApp; 
  77.  
  78.     
  79. /////////////////////////////////////////////////////////////////////////////
  80. // CMainFrame construction/destruction
  81.  
  82. CMainFrame::CMainFrame()
  83. {
  84.  // TODO: add member initialization code here
  85.  
  86.     // create a new LightLibraryImage (LLI) - object
  87.     lloApp = oNew( LLO_CLASS_APPLICATION,
  88.                    0, 
  89.                    -1,
  90.                    (DWORD)(0), 
  91.                    (DWORD)(LPSTR)"LLID, IMAGE-TEST-APPLICATION" );
  92.     OutputDebugString( "\n\rConstructor Mainframe... ");
  93.     oAssign( lloApp, LLO_APPLICATION_CARGO_COUNT_DEFAULT, 10, 0 );
  94.  
  95. }
  96.  
  97. /////////////////////////////////////////////////////////////////////////////
  98.  
  99. CMainFrame::~CMainFrame()
  100. {
  101.     // delete LightLibraryImage (LLI) - object
  102.     OutputDebugString( "\n\rDestructor Mainframe... ");
  103.     lloApp = oDel( lloApp );
  104. }
  105.  
  106. /////////////////////////////////////////////////////////////////////////////
  107.  
  108. int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
  109. {  
  110.  
  111.     if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
  112.         return -1;
  113.  
  114.     if (!m_wndToolBar.Create(this) ||
  115.         !m_wndToolBar.LoadBitmap(IDR_MAINFRAME) ||
  116.         !m_wndToolBar.SetButtons(buttons,sizeof(buttons)/sizeof(UINT)))
  117.     {
  118.         TRACE("Failed to create toolbar\n");
  119.         return -1;      // fail to create
  120.     }  
  121.  
  122.     // Statusbar
  123.     if (!m_wndStatusBar.Create(this) ||
  124.         !m_wndStatusBar.SetIndicators(indicators,
  125.         sizeof(indicators)/sizeof(UINT)))
  126.     {
  127.         TRACE("Failed to create status bar\n");
  128.         return -1;      // fail to create
  129.     }               
  130.               
  131.     return 0;
  132. }
  133.  
  134. /////////////////////////////////////////////////////////////////////////////
  135. // CMainFrame diagnostics
  136.  
  137. #ifdef _DEBUG
  138. void CMainFrame::AssertValid() const
  139. {
  140.     GetActiveWindow();
  141.     CMDIFrameWnd::AssertValid();
  142. }
  143.  
  144. void CMainFrame::Dump(CDumpContext& dc) const
  145. {
  146.     CMDIFrameWnd::Dump(dc);
  147. }
  148.  
  149. #endif //_DEBUG
  150.  
  151. /////////////////////////////////////////////////////////////////////////////
  152. // CMainFrame message handlers
  153.  
  154.  
  155.  
  156.